/*
 * @lc app=leetcode.cn id=1588 lang=typescript
 *
 * [1588] 所有奇数长度子数组的和
 */

// @lc code=start
function sumOddLengthSubarrays(arr: number[]): number {
    let sum = 0;
    for (let i = 0; i < arr.length; i++) {
        let temp = 0;
        for (let j = i; j < arr.length; j++) {
            temp += arr[j];
            if ((j - i) % 2 === 0) {
                sum += temp;
            }
        }
    }
    return sum;
}
// @lc code=end
